{include file="common/header"}
<div class="content-wrapper">
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="nav-tabs-custom">
                    <div class="tab-content">
                        <form method="post" class="form-horizontal form" id="post_form" enctype="multipart/form-data" >
                            <div class="panel panel-info">
                                <div class="panel-heading">
                                    特定图片
                                </div>
                                <div class="panel-body">
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">名称</label>
                                        <div class="col-sm-6 col-xs-12">
                                            <input type="text" class="form-control" id="msg" value="{$item['msg']?$item['msg']:''}" placeholder="请输入名称">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">图片</label>
                                        {if $item.img}
                                        <img src="{$item.img}" style="width:200px;height:200px;"/>
                                        {/if}
                                        <br/>
                                        <div class="col-sm-6 col-xs-12" style="margin-left:260px;margin-top:20px;">
                                            <input type="file"  name="img" id="img" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-6 col-xs-12 col-sm-offset-2">
                                            <input type="hidden" id="id" value="{$item['id']?$item['id']:0}">
                                            <button type="button" name="submit" class="btn btn-primary">提交</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                        <script type="text/javascript">
                            $(function () {
                                //提交分类信息
                                $("button[name='submit']").click(function () {
                                    var form = new FormData(document.getElementById("post_form"));
                                    form.append('img',$('#img')[0].files[0]);
                                    form.append('msg',$('#msg').val());
                                    form.append('id',$('#id').val());
                                    $.ajax({
                                      url: window.location.href,
                                      type: 'post',
                                      data:form,
                                      dataType: 'json',
                                      processData:false,
                                      contentType: false,
                                      success: function(res) {
                                        message(res.message,'/admin/teding/index',res.type)
                                      }
                                    })
                                    
                                    
                                    
                                    
                                    /*$.post(
                                        window.location.href,
                                        form,
                                        function (res) {
                                            message(res.message,res.redirect,res.type)
                                        },'json'
                                    );*/
                                });
                            });
                        </script>
                    </div>
                    <!-- /.tab-content -->
                </div>
                <!-- /.nav-tabs-custom -->
            </div>
            <!-- /.col -->
        </div>
    </section>
</div>
{include file='common/ufooter'}
